package com.sgg;

import com.sgg.service.IHelloService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

/**
 * @author ：brid
 * @date ：Created in 2021/5/28 11:32
 * @description：
 * @modified By：
 * @version: $
 */
@SpringBootApplication
public class ConsumerApplication {
    /**
     * 不使用注册中心，申明引用生产者端链接
     */
    @Reference(url = "dubbo://192.168.196.166:20880/com.sgg.service.IHelloService")
    private IHelloService helloService;

    public static void main(String[] args) {
        SpringApplication.run(ConsumerApplication.class , args);
    }

    @Bean
    public ApplicationRunner runner(){
        return args -> helloService.sayHello("1233333333333333333");
    }

    @Bean
    public void sayHello(){
        helloService.sayHello("你好娃哈哈");
    }
}
